package com.geovis.emergency.spd.biz.zwdd.config;


import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient;
import com.geovis.emergency.spd.biz.zwdd.props.ZwddProperties;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>
 * 海证通配置
 * </p>
 *
 * @author 王响
 * @since 2022-03-16
 */
@Configuration
@EnableConfigurationProperties(ZwddProperties.class)
@RequiredArgsConstructor
public class ZwddConfiguration {

    private final ZwddProperties zwddProperties;

    @Bean
    public ExecutableClient executableClient() {
        ExecutableClient executableClient = ExecutableClient.getInstance();
        executableClient.setAccessKey(zwddProperties.getAppkey());
        executableClient.setSecretKey(zwddProperties.getAppsecret());
        executableClient.setDomainName(zwddProperties.getDomainName());
        executableClient.setProtocal(zwddProperties.getProtocal());
        executableClient.init();
        return executableClient;
    }

}
